<%@LANGUAGE="VBSCRIPT"%>
 
<!--#include file="functions.asp" -->
<%
dim TheDate
TheDate = String(2-Len(CStr(Month(Date))),"0")& CStr(Month(Date))& "/"& String(2-Len(CStr(Day(Date))),"0")& CStr(Day(Date))& "/"&Year(Date)
Date2 = DateAdd("d",30, Date)
TheDate2 = String(2-Len(CStr(Month(Date2))),"0")& CStr(Month(Date2))& "/"& String(2-Len(CStr(Day(Date2))),"0")& CStr(Day(Date2))& "/"&Year(Date2)
%>

<%
set CompCode = Server.CreateObject("ADODB.Recordset")
CompCode.ActiveConnection = cn
CompCode.Source = "SELECT * FROM dbo.COMPCODE"
'CompCode.CursorType = 0
'CompCode.CursorLocation = 2
'CompCode.LockType = 3
CompCode.Open()
CompCode_numRows = 0
%>

<SCRIPT Language="JavaScript">

function DocLoad(){
document.form1.reqInvoiceNo.focus();
}

function CheckVendor(y)
{ if (y!="") {
window.open("ValVendor.asp?vendID="+y+"&src=document.form1.reqVendorID&fld=document.form1.VendorName","","width=300,height=120,Top=240,Left=240,toolbar=no,location=no,directories=no,status=no,scrollbars=no,menubar=no,resizable=no,")
} 
else document.form1.VendorName.value="";
}

function CheckCurr(y)
{ if (y!="") {
window.open("ValCurr.asp?CurrID="+y+"&src=document.form1.reqCurrency&fld=document.form1.exRate&fld2=document.form1.CurrSymbol","","width=300,height=120,Top=240,Left=240,toolbar=no,location=no,directories=no,status=no,scrollbars=no,menubar=no,resizable=no,")
} 
else 
{
document.form1.exRate.value="";
document.form1.CurrSymbol.value="";}
}

function CheckWHT(y)
{ if (y!="") {
window.open("ValWHT.asp?WHTID="+y+"&src=document.form1.WHTName&fld=document.form1.WHTRate","","width=300,height=120,Top=240,Left=240,toolbar=no,location=no,directories=no,status=no,scrollbars=no,menubar=no,resizable=no,")
} 
else document.form1.WHTRate.value="";
}

function CheckEmp(y)
{ if (y!="") {
window.open("ValEmpl.asp?EmpID="+y+"&src=document.form1.reqReceivedBy&fld=document.form1.empName&fld2=document.form1.Dept","","width=300,height=120,Top=240,Left=240,toolbar=no,location=no,directories=no,status=no,scrollbars=no,menubar=no,resizable=no,")
} 
else 
{
document.form1.empName.value="";
document.form1.Dept.value="";}
}

</SCRIPT>
<!-- #include file="pagetop.asp" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td nowrap height="21" bgcolor="#FFFFFF" width="3%" background="images/menu_end.gif">&nbsp;</td>
    <td nowrap height="21" bgcolor="#FFFFFF" width="28"> 
      <div align="center"><img src="images/menu_awal_off.gif" width="28" height="33"></div>
    </td>
    <td width="10%" background="images/menuoff.gif" height="21" nowrap> 
      <div align="center"><b><a href="InvList_WRO.asp" class="menu">Invoice List</a></b></div>
    </td>
    <td nowrap height="21" width="28"><img src="images/menu_off_off_separator.gif" width="28" height="33"></td>
    <td width="10%" background="images/menuoff.gif" height="21" nowrap> 
      <div align="center"><b><a href="Inv_DetailWRO.asp?seqnum=0" class="menu">Record 
        View</a></b></div>
    </td>
    <td width="28" height="21" nowrap><img src="images/menu_off_on_separator.gif" width="28" height="33"></td>
    <td width="10%" background="images/menuon.gif" height="21" nowrap> 
      <div align="center"><b></b><b class="menu">Invoice Register</b></div>
    </td>
    <td height="21" width="11" bgcolor="#FFFFFF"><img src="images/Menu_onend.gif" width="13" height="33"></td>
    <td height="21" bgcolor="#FFFFFF" background="images/menu_end.gif"> 
      <div align="right"><b><font color="#003399">Invoice Without Reference Order</font></b></div>
    </td>
  </tr>
  <tr bgcolor="#93bee2"> 
    <td height="21" width="3%" bgcolor="#93bee2">&nbsp;</td>
    <td height="21" width="28" bgcolor="#93bee2">&nbsp;</td>
    <td width="10%" height="21" bgcolor="#93bee2">&nbsp;</td>
    <td height="21" width="28">&nbsp;</td>
    <td width="10%" height="21">&nbsp;</td>
    <td width="28" height="21">&nbsp;</td>
    <td width="10%" height="21">&nbsp;</td>
    <td height="21" width="11">&nbsp;</td>
    <td height="21">&nbsp;</td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#93bee2">
  <tr> 
    <td width="4%" height="12">&nbsp;</td>
    <td width="2%" height="12">&nbsp;</td>
    <td height="12">&nbsp;</td>
  </tr>
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%" bgcolor="#FFFFFF"><img src="images/curv_data.gif" width="21" height="21"></td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
  </tr>
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%" bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF"> 
      <form name="form1" method="post" action="Inv_Process.asp" onSubmit="return checkrequired(this)">
        <table width="100%" border="0" cellspacing="2" cellpadding="3">
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Invoice No.:</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="reqInvoiceNo" size="25" maxlength="25" class="InputBox">
              <input type="hidden" name="seqnum2" value="0">
              <input type="hidden" name="RefOrder" value="N">
            </td>
            <td width="15%" bgcolor="#FFFFFF"> 
              <div align="right"></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td>&nbsp; </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Vendor ID:</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="reqVendorID" size="10" maxlength="10" class="InputBox" onBlur="CheckVendor(this.value);">
              <input type="button" name="Button22" value=" ... " class="sbttn" onClick="openpopup('VendorList.asp?fName=form1.reqVendorID&fName2=form1.VendorName')" >
            </td>
            <td width="15%" bgcolor="#FFFFFF"> 
              <div align="right"><b> </b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td bgcolor="#FFFFFF">&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Vendor Name:</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td colspan="4"> 
              <input type="text" name="VendorName" size="50" class="InputBox">
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Received Date:</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="ReceivedDate" size="12" maxlength="12" class="InputBox" value="<%= TheDate %>" onBlur="AddDate(this.value);document.form1.DueDate.focus();" onChange="AddDate(this.value)">
              <input type="button" name="Submit5" value=" ... " class="sbttn" onClick="javascript:show_calendar('form1.ReceivedDate');" onBlur="AddDate(document.form1.ReceivedDate.value)">
              <script language="JavaScript">
function AddDate(x)
{
var CurDate=new Date(x);
var ms=CurDate.getTime()+30*86400000;
var newDate=new Date(ms) ;
document.form1.DueDate.value = new String((newDate.getMonth()+1)+'/'+newDate.getDate()+'/'+newDate.getYear());
//document.form1.DueDate.value = String(CurDate);
}
</script>
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Due Date:</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="text" name="DueDate" size="12" maxlength="12" class="InputBox" value="<%= TheDate2 %>" onBlur="document.form1.reqReceivedBy.focus();">
              <input type="button" name="Submit52" value=" ... " class="sbttn" onClick="javascript:show_calendar('form1.DueDate')">
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Received By:</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="reqReceivedBy" size="10" maxlength="10" class="InputBox" onBlur="CheckEmp(this.value);" value="<%= empCode %>">
              <input type="button" name="Button223" value=" ... " class="sbttn" onClick="openpopup('EmpList.asp?fName=form1.reqReceivedBy&fName2=form1.empName&fName3=form1.Dept')" >
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Department:</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="text" name="Dept" size="30" maxlength="30" class="InputBox">
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="empName" size="30" class="InputBox" value="<%= usrFullName %>">
            </td>
            <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Currency:</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="reqCurrency" size="15" maxlength="15" class="InputBox" onBlur="CheckCurr(this.value)">
              <input type="button" name="Button222" value=" ... " class="sbttn" onClick="openpopup2('CurencyList.asp?fName=form1.reqCurrency&fName2=form1.exRate&fName3=form1.CurrSymbol')" >
              <input type="hidden" name="CurrSymbol">
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Exchange Rate:</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="text" name="exRate" size="15" class="InputBox">
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Invoice Amount:</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="InvoiceAmount" size="20" maxlength="20" class="NumBox" onBlur="calcWHT(document.form1.WHTRate.value,this.value)">
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>T0 Code:</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <select name="CompCode" class="drpdwn">
                <%
While (NOT CompCode.EOF)
%>
                <option value="<%=(CompCode.Fields.Item("COMPCODE").Value)%>" <% if (CompCode.Fields.Item("COMPCODE").Value="N01") then response.write "selected" %> ><%=(CompCode.Fields.Item("COMPCODE").Value)%> - <%=(CompCode.Fields.Item("COMPCODEDESC").Value)%></option>
                <%
  CompCode.MoveNext()
Wend
If (CompCode.CursorType > 0) Then
  CompCode.MoveFirst
Else
  CompCode.Requery
End If
%>
              </select>
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#FFFFFF"> 
              <div align="right"><b></b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="checkbox" name="cbVAT" value="Y">
              VAT Paid To Vendor</td>
            <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b><b><b><b>WHT Name:</b></b></b></b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="WHTName" size="15" maxlength="15" class="InputBox" onBlur="CheckWHT(this.value);calcWHT(document.form1.WHTRate.value,document.form1.InvoiceAmount.value)">
              <input type="button" name="Button2232" value=" ... " class="sbttn" onClick="openpopup('WHTList.asp?fName=form1.WHTName&fName2=form1.WHTRate')" onBlur="calcWHT(document.form1.WHTRate.value,document.form1.InvAmt.value)">
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b><b>WHT Rate:</b></b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="text" name="WHTRate" size="6" maxlength="6" class="NumBox" onBlur="calcWHT(this.value,document.form1.InvoiceAmount.value)">
              <script language="JavaScript">
function calcWHT(x,y){
  var WHTRate = Number(x);
  var InvAmt = Number(y);
  var WHTAmt = 0;
  WHTAmt = InvAmt * WHTRate/100;
  document.form1.WHTAmt.value=String(WHTAmt);
}
</script>
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>VAT Rate:</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="VATRate" class="NumBox" size="6" maxlength="6" value="10">
            </td>
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>WHT Amount:</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="text" name="WHTAmt" size="15" maxlength="15" class="NumBox">
            </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="checkbox" name="cbOri" value="Y">
              Original Invoice with Revenue Stamp</td>
            <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="checkbox" name="cbTax" value="Y">
              Tax Invoices (6 pages)</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td width="30%">&nbsp;</td>
            <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Action:</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="submit" name="Submit" value="    Save    " class="sbttn">
              <input type="button" name="Submit2" value="  Cancel  " class="sbttn">
            </td>
            <td width="15%" bgcolor="#FFFFFF"> 
              <div align="right"><b></b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table>
      </form>
    </td>
  </tr>
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%" bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
  </tr>
</table>
</body>
</html>
<%
CompCode.Close()
%>
